/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pt.our.angemc.datatypes;

import java.util.ArrayList;

/**
 *
 * @author piskeiro
 */
public class NonTerminal extends Symbol{

    private ArrayList<String> atribs;

    public ArrayList<String> getAtribs() {
        return atribs;
    }

    public NonTerminal(String name, Multiplier multiplier,boolean notMatch,ArrayList<String> atribs) {
        super(name, multiplier,notMatch);
        this.atribs = atribs;
    }

    public NonTerminal clone(){
        NonTerminal nonTerminal = new NonTerminal(getName(), getMultiplier(), this.isNotMatch() , getAtribs());
        return nonTerminal;
    }

    @Override
    public String toString()
    {
       StringBuffer sb = new StringBuffer();
       sb.append(this.getName());
       if(this.getAtribs()!= null && !this.getAtribs().isEmpty())
       {
           sb.append("[");
           int i = 0;
           for(String s : this.getAtribs())
           {
               if(i == 1){ sb.append(" ,");}
               sb.append(s);
           }
           sb.append("]");
       }
       sb.append(this.getMultiplier().getMultiplierRepresentationAsString().trim());
       return sb.toString();
    }
}
